import './App.scss';

import * as React from 'react';
import { connect } from 'react-redux';

import { addWorkView, bindWorkViewRouter } from '../../config/workViewAction';

import TopMenu from './TopMenu';
import ViewPanel from './ViewPanel';
import ViewTabPanel from './ViewTabPanel';

interface IProps {
  addWorkView: any;
  bindWorkViewRouter: any;
}

class App extends React.Component<IProps, any> {
  componentDidMount() {
    const { addWorkView, bindWorkViewRouter } = this.props;
    addWorkView(location.hash);
    bindWorkViewRouter();
  }

  render() {
    return (
      <div className='application'>
        {/*<TopMenu />
        <ViewTabPanel />*/}
        <ViewPanel />
      </div>
    );
  }
}

const mapDispatchToProps = (dispatch: any) => ({
  addWorkView: (path: string) => dispatch(addWorkView(path)),
  bindWorkViewRouter: () => dispatch(bindWorkViewRouter())
});

export default connect(null, mapDispatchToProps)(App)
